home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / text / tex / amiweb2c.lha / AmiWeb2c-2.1 / texmf / pastex / rexx / StartDVIprint.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-02-09  |  1.9 KB  |  100 lines

  1. /*
  2. ** StartDVIprint.rexx
  3. **
  4. ** This is a small hack to run DVIprint through ARexx, so as it may be
  5. ** called from ShowDVI or other programs.
  6. **
  7. ** INPUTS: Same as to DVIprint, but use long option names. The last argument
  8. ** must be the name of an existing file.
  9. */
  10. If ~Show('Libraries','rexxsupport.library') Then Do
  11.   If ~AddLib('rexxsupport.library',0,-30) Then Do
  12.     Say "Sorry, RexxSupport.library required"
  13.     Exit 20 /* for statef() function */
  14.   End
  15. End
  16.  
  17. /*
  18. ** Provides StringReq("Title","initial string",StringBufSize,VisibleSize)
  19. */
  20. If ~Show('Libraries','req.library') Then
  21.   If ~AddLib('req.library',-5,-60,2) Then Do
  22.     Say "Can't open 'req.library'!"
  23.     Exit 20
  24. End
  25. /*
  26. ** ReqLib is less than ideal for what I want to do ...
  27. */
  28.  
  29. /*
  30. ** OPTIONS RESULTS
  31. **
  32. ** This is commented out
  33. */
  34.  
  35. /*
  36. ** Keep it as simple as possible, e.g., the arguments allowed are
  37. ** passed through to DVIprint.
  38. */
  39.  
  40. Parse Arg ARGUMENTS
  41.  
  42. NUMARGS = Words(ARGUMENTS)
  43.  
  44. /*
  45. ** Last arg must be the FileName ...
  46. */
  47. If Word(StateF(Word(ARGUMENTS,NUMARGS)),1) ~= "FILE" Then Do
  48.   NAME = StringReq(".dvi filename",,127,40)
  49.   If NAME ~= "" Then
  50.      ARGUMENTS = ARGUMENTS NAME
  51.   Else
  52.      Exit
  53. End
  54.  
  55. /*
  56. ** Look for 'FROM' KeyWord
  57. */
  58. REQN = Para("from",ARGUMENTS)
  59. If 0 = REQN Then Do
  60.   REQN = IntReq("print from page ?", -100000, +100000)
  61.   If REQN ~= "" Then
  62.     ARGUMENTS = ARGUMENTS" from "REQN
  63. End
  64.  
  65. /*
  66. ** Look for 'TO' KeyWord
  67. */
  68. REQN = Para("to",ARGUMENTS)
  69. If 0 = REQN Then Do
  70.   REQN = IntReq("print upto page ?", -100000, +100000)
  71.   If REQN ~= "" Then
  72.     ARGUMENTS = ARGUMENTS" to "REQN
  73. End
  74.  
  75. Say "executing: DVIprint "ARGUMENTS
  76.  
  77. Address COMMAND DVIPrint ARGUMENTS
  78.  
  79. Exit
  80.  
  81. /*
  82. ** See if specific parameter was given
  83. */
  84. Para: Procedure Expose NUMARGS
  85.  
  86. /*
  87. ** All switched to uppercase
  88. */
  89. Arg NAME, PARAMETERS
  90.  
  91. FOUNDAT = 0
  92. Do I = 1 For NUMARGS
  93.   If Word(PARAMETERS,I) = NAME Then Do
  94.     FOUNDAT = I
  95.     Leave
  96.   End
  97. End
  98.  
  99. Return FOUNDAT
  100.